package site.template;

import java.util.List;

import site.tagtype.ShopInfoTableTag;
import site.tagtype.base.SimpleBaseTag;

import commerce.hibernate.po.Shop;

public class ShopSimpleSiteTemplate {
	// 各种属性
	private String[] keywords;
	// ....
	
	// 该模板的各种标签
	private SimpleBaseTag htmlTag;
	private SimpleBaseTag titleTag;
	private SimpleBaseTag headTag;
	private SimpleBaseTag bodyTag;
	private ShopInfoTableTag shopInfoTableTag;
	
	
	public ShopSimpleSiteTemplate(List<Shop> sList) {
		shopInfoTableTag = new ShopInfoTableTag(sList);
	}

	private void initTags() {
		htmlTag = new SimpleBaseTag("html");
		titleTag = new SimpleBaseTag("title");
		headTag = new SimpleBaseTag("head");
		bodyTag = new SimpleBaseTag("body");

		// 配置各标签之间的关系
		htmlTag.addChild(headTag);
		htmlTag.addChild(bodyTag);
		headTag.addChild(titleTag);
		bodyTag.addChild(shopInfoTableTag);

	}

	public String getHtml() {
		initTags();
		return htmlTag.getAllTagData();
	}

	public static void main(String[] args) {
		//System.out.println(new ShopSimpleSiteTemplate().getHtml());
	}
}
